<template>
  <div class="takeOver">
    <header class="top">
      <span @click="back">返回</span>
      <span v-text="title"></span>
    </header>
    <van-cell-group>
  <van-cell v-for="(v,i) in address" class="addressCell" :key="i" :title="v.address"  :label="v.address_detail" />
</van-cell-group>
<van-cell title="新增收货地址" is-link to="/my/takeOver/addAddress" />
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  name: "takeOver",
  data() {
    return {
      title: "收货信息",
      address:{},
    };
  },
  created() {
    this.getTakeOver();
  },
  methods: {
    back() {
      this.$router.back();
    },
    getTakeOver() {
      let api = this.eleUrl.takeOver + this.userLoginMsg.id + "/addresses";
      this.$http({
        url: api,
        method: "get",
      }).then((res) => {
          this.address=res.data
        console.log(res.data);
      });
    },
  },
  computed: {
    ...mapState(["eleUrl", "userLoginMsg"]),
  },
};
</script>

<style>
.takeOver {
  font-size: 0.15rem;
}
.top {
  height: 0.4rem;
  width: 100%;
  background-color: rgb(80, 143, 238);
}
.top > span {
  color: white;
  line-height: 0.4rem;
  margin-left: 0.2rem;
}
.top > span:nth-child(2) {
  margin-left: 1.2rem;
  font-weight: bold;
}
.addressCell{
    margin: .01rem;
    background-color: rgb(242, 248, 187);
}
</style>